package com.tongle.frs.common.util;

import java.util.Random;

public class GeneratePswdUtils
{
  private static final String[] pwdContentArr;

  public static String getPswd(int length)
  {
    StringBuilder b = new StringBuilder();

    for (int i = 0; i < length; i++) {
      Random r = new Random();
      int k = r.nextInt();
      b.append(String.valueOf(pwdContentArr[Math.abs(k % 76)]));
    }
    return b.toString();
  }

  static
  {
    StringBuilder pwdCon = new StringBuilder();
    pwdCon.append("a,b,c,d,e,f,g,h,i,g,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z");
    pwdCon.append(",A,B,C,D,E,F,G,H,I,G,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z");
    pwdCon.append(",~,@,#,$,%,^,&,*,(,),_,+,|,`,.");
    pwdCon.append(",1,2,3,4,5,6,7,8,9,0");
    pwdContentArr = pwdCon.toString().split(",");
  }
}